package com.ctl.szmd.szmd.feature_wm.data.mapper.wm

import com.ctl.szmd.szmd.feature_wm.data.bean.CommonInfoForApiDetail
import com.ctl.szmd.szmd.feature_wm.data.mapper.Mapper
import com.ctl.szmd.szmd.feature_wm.data.model.WmDataListModel

/**
 * created by : chentl
 * Date: 2020/07/30
 */
class ListAttachment2WmDataListModel : Mapper<CommonInfoForApiDetail, List<WmDataListModel>> {
    override fun map(input: CommonInfoForApiDetail?): List<WmDataListModel>? {
        if (input != null) {
            if (!input.AttachmentInfoForApiList.isNullOrEmpty()) {
                val data = mutableListOf<WmDataListModel>()
                for (list in input.AttachmentInfoForApiList) {
                    data.add(
                        WmDataListModel(
                            attachmentName = list.AttachmentName,
                            attachmentNetPath = list.AttachmentNetPath
                        )
                    )
                }
                return data
            }
        }
        return null
    }
}